//
//  UIViewController+WSJLodingView.m
//  sanda
//
//  Created by wsj2015 on 16/7/16.
//  Copyright © 2016年 陈武琦. All rights reserved.
//

#import "UIViewController+WSJLodingView.h"


@implementation UIViewController (WSJLodingView)



- (void)wsj_showLodingGif{

    UIView *view =[UIView new];
    view.frame = CGRectMake(0, 0, kScreenWidth, kScreenHeight);
    view.backgroundColor =[UIColor whiteColor];
    view.tag = 900;
    UIImageView *imageView =[UIImageView new];
    CGFloat h =60;
    CGFloat w = 30;
    imageView.frame  =CGRectMake((kScreenWidth-w)/2, (kScreenHeight-64-h)/2, w, h);
  
    NSMutableArray *refreshingImages = [NSMutableArray array];
    for (NSUInteger i = 1; i<=24; i++) {
        UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"dropdown_loading_0%zd", i]];
        [refreshingImages addObject:image];
    }
    imageView.animationImages =refreshingImages;
    [imageView startAnimating];
    
    [view addSubview:imageView];
    [self.view addSubview:view];
    
}
- (void)wsj_hideLodingGif{

    UIView *loadingView =[self.view viewWithTag:900] ;
    [UIView animateWithDuration:.35f animations:^{
        loadingView.alpha = 0.0001;
         [loadingView removeFromSuperview];
    }];
    
   


}

@end
